﻿@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <title>环保网站后台管理</title>
    <link href="~/Content/jquery-easyui-1.3.1/themes/icon.css" />
    <link href="~/Content/jquery-easyui-1.3.1/themes/default/easyui.css" rel="stylesheet" />


    <script src="~/Content/jquery-easyui-1.3.1/jquery-1.8.0.min.js"></script>
    <script src="~/Content/jquery-easyui-1.3.1/jquery.easyui.min.js"></script>
    <script src="~/Content/jquery-easyui-1.3.1/locale/easyui-lang-zh_CN.js"></script>
   @*<script src="../../Scripts/jquery-1.3.2.min.js" type="text/javascript" charset='utf-8'></script>*@
<script src="~/Scripts/jquery.bgiframe.min.js" type="text/javascript" charset='utf-8'></script>
<script type="text/javascript" src="~/Scripts/loading-min.js" charset="UTF-8"></script>
<link href="~/Scripts/loading.css" type="text/css" rel="stylesheet">
    <style type="text/css">
        #imgCode {
            cursor:pointer;
        }
    </style>

   <script src="jquery.1.3.2.min.js" type="text/javascript" language="javascript"></script> 

    <script type="text/javascript">

        $(function () {
            document.onkeydown = function (e) {
                var ev = document.all ? window.event : e;
                if (ev.keyCode == 13) {
                        //验证用户必须输入必填项
                        var validate = $("#ff").form("validate");
                        if (validate == false) {
                            return false;
                        }
                        //获取传递前台的参数，UName，Pwd，Code
                        var postData = {
                            UserName: $("#UserName").val(),
                            PassWord: $("#PassWord").val(),
                            Code: $("#Code").val()
                        };                    
                    loading.show();//开始转圈
                    //异步实现登录功能
                    $.post("/Login/CheckUserLogin", postData, function (data) {
                        if (data == "OK") {
                            window.location.href = "/Home/Index";
                        }
                        else {
                            alert(data);
                            window.location.href = "/Login/Index/";
                        }
                    });
                }
            }
        });

    </script>


    <script type="text/javascript">

        if (window.parent.window != window) {

            window.top.location.href = "/Login/Index";
        }
        $(function () {
            loading = new ol.loading({ id: "AddUserDialog" });
            //实现用户的登录信息
            LoginUserInfo();
            EnterPress();

        });



        //异步实现用户的登录
        function LoginUserInfo(LoginUserInfo) {
            $("#btnLogin").click(function () {

                    //验证用户必须输入必填项
                    var validate = $("#ff").form("validate");
                    if (validate == false) {
                        return false;
                    }
                    //获取传递前台的参数
                    var postData = {
                        UserName: $("#UserName").val(),
                        PassWord: $("#PassWord").val(),
                        Code: $("#Code").val()
                    };
                loading.show();//开始转圈
                //异步实现登录功能
                $.post("/Login/CheckUserLogin", postData, function (data) {
                    if (data == "OK") {
                        window.location.href = "/Home/Index";
                    }
                    else {
                        alert(data);
                        window.location.href = "/Login/Index/";
                    }
                });

            });
        }

        //单击重新改变验证码
        function RefreshValidateCode(obj) {
            obj.src = "/Login/ValidateCode/" + Math.floor(Math.random() * 10000);
        }

    </script>
</head>
<body>

    @*-------------------设置用户登录信息的弹出层-------------------*@
    <div id="AddUserDialog" class="easyui-dialog" style="width:400px;height:240px;padding:10px 20px"
			  modal="true" closable="false" title="后台登录" buttons="#dlg-buttons" align="center">
        <form id="ff" method="post" novalidate="novalidate">
            <table id="tblAdd">
                <tr>
                    <th colspan="2" >环保网站后台登录</th>
                </tr>
                <tr>
                    <td><label for="UserName">用户名：</label></td>
                    <td><input class="easyui-validatebox" type="text" id="UserName" name="UserName" value="@ViewBag.UserName" data-options="required:true,validType:'length[1,32]'" /></td><td>
                </tr>
                <tr>
                    <td><label for="PassWord">密  码：</label></td>
                    <td><input class="easyui-validatebox" type="password" id="PassWord" name="PassWord"  data-options="required:true,validType:'length[1,32]'" /></td>
                </tr>
                <tr>
                    <td><label for="Code">验证码：</label></td>
                    <td><input class="easyui-validatebox" style="width:90px" type="text" id="Code"  name="Code"  data-options="validType:'length[1,32]'" /> <img align="center" height="28px" alt="点击刷新验证码！" title="点击刷新验证码！" src="/Login/ValidateCode" style="cursor: pointer;"
                                onclick="RefreshValidateCode(this);" />
                    </td>
                </tr>
                <tr>
                    <td colspan="2" style="text-align:center; padding-top:10px">
                        <a href="javascript:void(0)" class="easyui-linkbutton" id="btnLogin"  >登  录</a>
                        &nbsp;&nbsp
                        <a href="javascript:void(0)" class="easyui-linkbutton" id="btnCancel"  >取  消</a>
                    </td>
                </tr>
            </table>
        </form>
    </div>
   
</body>
</html>
